package net.doglog;

import java.io.*;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.*;

@SuppressWarnings("serial")
public class FeedServlet extends HttpServlet {
	public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		List<Post> allPosts = PostUtil.getAllPosts();
		int toIndex = Math.min(Blog.postPerFeed, allPosts.size());
		req.setAttribute("posts", allPosts.subList(0, toIndex));
		req.getRequestDispatcher("/feed.jsp").forward(req, resp);
	}
}
